package cn.tedu.admin.companyandjob.controller;

import cn.tedu.admin.companyandjob.pojo.param.JobParam;
import cn.tedu.admin.companyandjob.pojo.vo.JobListItemVO;
import cn.tedu.admin.companyandjob.service.IJobService;
import cn.tedu.common.pojo.vo.PageData;
import cn.tedu.common.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.spring.web.json.Json;

@RestController
@RequestMapping("/jobs")
@Api(tags = "职位管理模块")
public class JobController {

    @Autowired
    IJobService iJobService;

    @GetMapping("/select/jobs")
    @ApiOperation("查询职位列表功能")
    public JsonResult selectJobList(Integer pageNum){
        PageData<JobListItemVO> list = iJobService.selectJobList(pageNum);
        return JsonResult.ok(list);
    }

    @PostMapping("update/jobs")
    @ApiOperation("修改职位信息功能")
    public JsonResult updateJobs(Long jobId,JobParam jobParam){
        iJobService.updataJob(jobId,jobParam);
        return JsonResult.ok();
    }

    @PostMapping("/delete/jobs")
    @ApiOperation("删除职位信息功能")
    public JsonResult deleteJob(Long jobId){
        iJobService.deleteJob(jobId);
        return JsonResult.ok();
    }
}
